import java.util.ArrayList;
import java.util.Iterator;

public class Demo7FanXing {
    public static void main(String[] args) {
        ArrayList <String> arrayList=new ArrayList<>();
        arrayList.add("xxx");
        arrayList.add("yyy");

        ArrayList <Student> arrayList2=new ArrayList<>();

        Student s1=new Student("刘德华",20);
        Student s2=new Student("蒋恬",21);
        Student s3=new Student("陈海",22);
        arrayList2.add(s1);
        arrayList2.add(s2);
        arrayList2.add(s3);

        Iterator iterator=arrayList2.iterator();
        while (iterator.hasNext())
        {
            System.out.println(iterator.next());
        }
    }
}
